//
//  Set_layoutTableViewCell.m
//  HappyRent
//
//  Created by CoderYee on 2017/3/29.
//  Copyright © 2017年 内圈科技. All rights reserved.
//

#import "Set_layoutTableViewCell.h"

@implementation Set_layoutTableViewCell
-(void)addOwnView
{
    [self setBackgroundColor:kClearColor];
    _layoutButton=[UIButton buttonWithType:UIButtonTypeCustom];
    [_layoutButton setBackgroundColor:kNavBarThemeColor];
    [_layoutButton setTitle:@"退出登录" forState:UIControlStateNormal];
    _layoutButton.titleLabel.font=systemfont(14);
    _layoutButton.layer.masksToBounds=YES;
    _layoutButton.layer.cornerRadius=KCornerRadiusWidth;
    [_layoutButton addTarget:self action:@selector(clickButtonEvent:) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:_layoutButton];
    [_layoutButton mas_makeConstraints:^(MASConstraintMaker *make)
     {
        make.edges.equalTo(self.contentView).insets(UIEdgeInsetsMake(2, 15, 2, 15));
     }];
}
-(void)layoutSubviews{

    [super layoutSubviews];
    if ([self respondsToSelector:@selector(setSeparatorInset:)]){
        [self setSeparatorInset:UIEdgeInsetsMake(0, kMainScreenWidth, 0, -kMainScreenWidth)];
    }
    if ([self respondsToSelector:@selector(setLayoutMargins:)]){
        [self setLayoutMargins:UIEdgeInsetsMake(0, kMainScreenWidth, 0, -kMainScreenWidth)];
    }
    if([self respondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)]){
        
        [self setPreservesSuperviewLayoutMargins:NO];
    }
}
-(void)clickButtonEvent:(UIButton *)sender
{
    
    if (self.delegate&&[self.delegate respondsToSelector:@selector(clickTableView:withEventType:)]) {
        [self.delegate clickTableView:self withEventType:TableClickEventValue1];
    }
    
    
}

@end
